home *** CD-ROM | disk | FTP | other *** search
- if(PLAY_MODE == "director")
- {
- _global.lingo = function(str)
- {
- getURL("lingo:" + str,"");
- };
- }
- else if(PLAY_MODE == "browser")
- {
- _global.lingo = function(str)
- {
- trace("lingo:" + str);
- };
- _global.statusBar = function(str)
- {
- getURL("javascript:void(window.status=\'" + str + "\')","");
- };
- }
- _global.error = function(str)
- {
- trace("error : " + str);
- };
- _global.Tardis = this;
- depth = 1;
- childlock = false;
- ChildLock = {};
- ChildLock.active = false;
- ChildLock.lockDialog = function()
- {
- lingo("spriteDialog.show(\"child_lock\")");
- };
- ChildLock.unlockDialog = function()
- {
- lingo("spriteDialog.show(\"child_unlock\")");
- };
- ChildLock.lock = function()
- {
- this.active = true;
- var node = sideMenu.mc_lock.node;
- var str = node.attributes.lock;
- node.attributes.lock = node.attributes.label;
- node.attributes.label = str;
- this.EB.broadcastMessage("childLockSet",true);
- };
- ChildLock.unlock = function()
- {
- this.active = false;
- var node = sideMenu.mc_lock.node;
- var str = node.attributes.lock;
- node.attributes.lock = node.attributes.label;
- node.attributes.label = str;
- this.EB.broadcastMessage("childLockSet",false);
- };
- ChildLock.EB = {};
- ASBroadcaster.initialize(ChildLock.EB);
- ConnCheck = {dbg:function(str)
- {
- trace("ConnCheck." + str);
- },test:function()
- {
- lingo("Flsh_connection_startCheck");
- if(this.FAKE_CONNECTION != undefined)
- {
- this.onTestComplete(this.FAKE_CONNECTION);
- }
- },onTimerComplete:function()
- {
- this.test();
- },startTimer:function()
- {
- this.test();
- this.stopTimer();
- this.nmTimerID = setInterval(this,"onTimerComplete",this.TIMER_INTERVAL * 1000);
- },stopTimer:function()
- {
- this.dbg("stopTimer()");
- clearInterval(this.nmTimerID);
- },TIMER_INTERVAL:null,DEBUG:"verbose"};
- UsageData = {dbg:function(str)
- {
- trace("UsageData." + str);
- },init:function()
- {
- var trySOprop = function(objSo, name, §set§)
- {
- var val = objSo.data[name];
- if(val == null)
- {
- objSo.data[name] = eval("set");
- return eval("set");
- }
- return val;
- };
- var makeUID = function()
- {
- return Math.random().toString().substr(2,7) + "" + Math.random().toString().substr(2,7);
- };
- var parent = this;
- this.soIssue = SharedObject.getLocal("TardisV" + Tardis.Settings.version);
- this.soGlobal = SharedObject.getLocal("TardisGlobal");
- if(this.soIssue.getSize() > this.KB_LIMIT)
- {
- this.dbg("size has exceeded " + this.KB_LIMIT / 1024 + "Kb\nClearing log and ping data...");
- this.soIssue.data.logData = [];
- this.soIssue.data.pingData = [];
- this.dbg("cleared. size is now " + this.soIssue.getSize() / 1024 + "Kb");
- }
- var strUID = this.soGlobal.data.UID;
- if(strUID == null || strUID == "")
- {
- this.FirstTime = true;
- strUID = makeUID();
- }
- else
- {
- this.FirstTime = false;
- }
- this.soGlobal.data.UID = this.UID = strUID;
- this.dbg("UID : " + this.UID);
- this.logData = trySOprop(this.soGlobal,"logData",[]);
- this.pingData = trySOprop(this.soIssue,"pingData",[]);
- this.optin = trySOprop(this.soGlobal,"optin",true);
- this.skipprizedraw = trySOprop(this.soIssue,"skipprizedraw",false);
- this.times_intro_skip = trySOprop(this.soIssue,"times_intro_skip",false);
- this.sponsor_intro_skip = trySOprop(this.soIssue,"sponsor_intro_skip",false);
- this.soIssue.flush();
- this.soGlobal.flush();
- this.lastTime = null;
- this.lastPage = null;
- },addPageEntry:function(pageValue)
- {
- trace("UsageData : addPageEntry : pageValue : " + pageValue);
- var now = getTimer();
- var sessionGroup = this.logData[this.logData.length - 1];
- if(this.lastTime != null)
- {
- var timeValue = Math.round((now - this.lastTime) / 1000);
- var currEntries = sessionGroup.entries;
- currEntries.push(timeValue + "." + this.lastPage);
- this.dbg("addPageEntry : " + timeValue + "." + pageValue);
- }
- else
- {
- sessionGroup.startTime = this.getTimeStamp();
- }
- this.lastTime = now;
- this.lastPage = pageValue;
- },addAdvertEntry:function(val)
- {
- trace("UsageData : addAdvertEntry : value : " + val);
- this.penultimateEntry = this.lastPage;
- var strLog = Tardis.Sections.length + 1 + "." + val;
- this.addPageEntry(strLog);
- },addAdvertEndEntry:function()
- {
- this.addPageEntry(this.penultimateEntry);
- },addSessionGroup:function()
- {
- var objG = {time:this.getTimeStamp(),entries:new Array(),startTime:null,version:Tardis.Settings.version};
- this.logData.push(objG);
- },addPingEntry:function()
- {
- var obj = {firsttime:this.FirstTime,time:this.getTimeStamp()};
- this.pingData.push(obj);
- },findAndReplace:function(strStr, strSearch, strReplace)
- {
- var i = 0;
- var l = strStr.length;
- var strTemp;
- while(i < l)
- {
- if(strStr.charAt(i) == strSearch)
- {
- strTemp += strReplace;
- }
- else
- {
- strTemp += strStr.charAt(i);
- }
- i++;
- }
- return strTemp;
- },sendToServer:function()
- {
- var strURL = "";
- trace("UsageDate : sendToServer");
- if(this.pingData.length > 0)
- {
- var objP = this.pingData[0];
- var strBaseURL = this.PING_URL + "?";
- var strQuery = "cd=" + Tardis.Settings.version + "&u=" + this.UID + "&t=" + objP.time;
- if(objP.firsttime == true)
- {
- strQuery += "&first=1";
- }
- }
- else
- {
- var objGroup = this.logData[0];
- var arrEntries = objGroup.entries;
- var len = arrEntries.length;
- if(len == 0)
- {
- if(this.logData.length > 1)
- {
- this.dbg("empty cached group - deleting");
- this.logData.shift();
- }
- else
- {
- this.dbg("no cached data - no new data");
- }
- if(this.logData.length > 1 && delete_counter < 100)
- {
- this.checkSend();
- }
- else
- {
- delete_counter = 0;
- }
- delete_counter++;
- return undefined;
- }
- delete_counter = 0;
- var len = Math.min(arrEntries.length,10);
- var strBaseURL = this.LOG_URL + "?";
- var strQuery = "";
- strQuery += "cd=" + objGroup.version;
- strQuery += "&u=" + this.UID;
- strQuery += "&t=" + objGroup.time;
- strQuery += "&s=" + objGroup.startTime;
- strQuery += "&d=" + arrEntries.slice(0,len).join(":");
- this.num_logs_sent = len;
- }
- strMacOsxSafeQuery = this.findAndReplace(strQuery,":","_");
- strURL = strBaseURL + strMacOsxSafeQuery;
- trace("-*- UsageData : sendToServer : strURL : " + strURL);
- lingo("Flsh_usage_sendData(\"" + strURL + "\")");
- this.active = true;
- },checkSend:function()
- {
- if(this.active == false && (this.pingData.length > 0 || this.optin == true))
- {
- this.sendToServer();
- }
- else
- {
- this.dbg("no data to send");
- }
- },onSent:function(success)
- {
- with(this)
- {
- active = false;
- dbg("data sent (" + success + ")");
- if(success)
- {
- if(pingData.length > 0)
- {
- pingData.shift();
- }
- else
- {
- var entries = logData[0].entries;
- entries.splice(0,num_logs_sent);
- if(logData.length > 1 && entries.length == 0)
- {
- dbg("last group now empty - deleting");
- logData.shift();
- }
- }
- checkSend();
- }
- else
- {
- dbg("send failed");
- }
- }
- },setOptIn:function(val)
- {
- trace("UsageData.setOptIn(" + val + ")");
- this.optin = this.soGlobal.data.optin = val;
- this.soGlobal.flush();
- },setSkipPrizeDraw:function(val)
- {
- trace("UsageData.setSkipPrizeDraw(" + val + ")");
- this.skipprizedraw = this.soIssue.data.skipprizedraw = val;
- this.soIssue.flush();
- },deleteSoProp:function(SO, prop)
- {
- delete this[SO].data[prop];
- },setSoProp:function(SO, prop, val)
- {
- this[SO].data[prop] = val;
- trace("val: " + val);
- trace("setSoProp : prop : " + prop + " : " + " val : " + val);
- this[SO].flush();
- return val;
- },getSoProp:function(SO, prop)
- {
- return this[SO].data[prop];
- },getTimeStamp:function()
- {
- var pf = function(nm)
- {
- nm = nm.toString();
- return nm.length != 1 ? nm : "0" + nm;
- };
- var d = new Date();
- var s = "" + pf(d.getUTCDate()) + "." + pf(d.getUTCMonth() + 1) + "." + d.getUTCFullYear() + ":" + pf(d.getUTCHours()) + "." + pf(d.getUTCMinutes()) + "." + pf(d.getUTCSeconds());
- return s;
- },LOG_URL:null,PING_URL:null,KB_LIMIT:10240,DEBUG:"none",delete_counter:0,active:false};
- SFX = {};
- SFX.volume_setting = 4;
- SFX.play = function(str)
- {
- lingo("Flsh_soundPlay \"" + str + "\"");
- };
- SFX.setVolume = function(inc)
- {
- lingo("Flsh_volume_set(" + inc + ")");
- this.volume_setting = inc;
- };
- SFX.onVolumeGet = function(val)
- {
- this.volume_setting = val;
- };
- SFX.init = function()
- {
- lingo("Flsh_volume_get");
- };
- SFX.init();
- delete SFX.init;
-